import { getAddress } from '@/utils/auth.js'
export default {
	namespaced: true,
	state: {
		
		location:{},   		//定位详情 包含所有
		locationInfo:{},		//经纬度
		locationAddress:'',		//详细地址   如：某某街道几号
		
		
		
		
		addressList: [],
		addressObj:{},   //key值存储
		
		//表示当前选的展示的默认地址
		nowId:'',
		//订单需要改地址时的ID
		orderAddress:'',
		
	},
	mutations: {
		SET_LOCATION(state, location) {
			state.location = location;
		},
		SET_LOCATIONADDRESS(state, location) {
			state.locationAddress = location;
		},
		SET_LOCATIONOB(state, newlocationOb) {
			state.locationInfo = newlocationOb;
		},
		
		
		
		//删除临时选择的地址
		REMOVE_OEDERADDRESS(state ){
			state.orderAddress = '';
		},
		SET_OEDERADDRESS(state,address ){
			state.orderAddress = address;
		},
		//设置初始加载时的默认地址
		SET_DEFAULT(state, id) {
			//当前没有选择的临时ID时才修改
			if(!state.nowId){
				state.nowId = id;
			}
		},
		//当前地址
		SET_NOWID(state, id) {
			state.nowId = id;
		},
		SET_OBJ(state,obj){
			state.addressObj = obj
		},
		SET_LIST(state, list) {
			state.addressList = list;
		},
		
		CLEAR(state){
			state.addressList = []
			state.addressObj = {}
			state.nowId = ''
			state.orderAddress = ''
		}
	},
	getters: {

	},
}
